<html>

	<head>

	

	</head>
	<body>

<?php

	@$filtrando = $_GET['filtro'];


	echo "

		<html>

			<body>
				<div id='titulo'>Transferencias</div>
				<div id='titulo6'>
					<form action='filtrartrans.php' method='post'>
						<select name='almacen'>
						<option value=''>Almacen</option>
	";
	
						$conexion = mysql_connect($servidor,$usuario,$clave);
						mysql_select_db($db,$conexion);
						
						$peticion = mysql_query("SELECT * FROM almacenes");
						while ($fila = mysql_fetch_array($peticion)){
						
							echo "
							
							<option value=".$fila['lugar'].">".$fila['lugar']."</option>
							
							";
							}
	
	echo "
						</select>
						
						<select name='lugarcompra'>
						<option value=''>Proveedor</option>
	";
						$conexion1 = mysql_connect($servidor,$usuario,$clave);
						mysql_select_db($db,$conexion1);
						
						$peticion1 = mysql_query("SELECT * FROM proveedores");
						while ($fila1 = mysql_fetch_array($peticion1)){
						
							echo "
							
							<option value=".$fila1['nombre'].">".$fila1['nombre']."</option>
							
							";
							}
	
	
	echo"
						</select>
						
						<select name='idarticulo'>
						<option value=''>Articulo</option>
	";
	
						$conexion2 = mysql_connect($servidor,$usuario,$clave);
						mysql_select_db($db,$conexion2);
						
						$peticion2 = mysql_query("SELECT * FROM articulos");
						while ($fila2 = mysql_fetch_array($peticion2)){
						
							echo "
							
							<option value=".$fila2['id'].">".$fila2['marca']." ".$fila2['modelo']." ".$fila2['talla']."</option>
							
							";
							}
	
	echo "
						</select>
						
						<button type='submit'><img src='../images/iconos/filtro.png' alt='Enviar'/>
						</form>
						
				</div>
	";

	
	$conexion = mysql_connect($servidor,$usuario,$clave);
	mysql_select_db($bd,$conexion);

	@$peticion = mysql_query("SELECT * FROM compras WHERE estadoart <> 'vendido' AND $filtrando");

	
	echo "

		<table class='tabla1' width=940>
		<tr>
		<th>Id</th>
		<th>Id Objeto</th>
		<th>Proveedor</th>
		<th>Almacen</th>
		<th>Destino</th>
		<th></th>
		</tr>
	";

	while (@$fila = mysql_fetch_array($peticion)){

		echo "
		<form action='nuevotransferir.php?id=".$fila['id']."' method='POST'>
			<tr>

				<td>".$fila['id']."</td>
				<td>".$fila['idarticulo']."</td>
				<td>".$fila['lugarcompra']."</td>
				<td>".$fila['almacen']."</td>
				<td><select id='almacendestino' name='almacendestino'>
		";
		
				
						$conexion1 = mysql_connect($servidor,$usuario,$clave);
						mysql_select_db($bd,$conexion1);

						$peticion1 = mysql_query("SELECT * FROM almacenes");
						
						while ($file = mysql_fetch_array($peticion1)){
						
							echo "
							
								<option value=".$file['lugar'].">".$file['lugar']."</option>
							
							";
							}	
			
		echo "		
				
				
				</select>
				</td>
				
				
				<td><input type='image' src=\"../images/iconos/transfer.png\"/></td>
				</form>
				
				</tr>

				


		";
	}

	echo " </table> 

	";
	




?>

</body>

</html>